﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ors.RInterface.Engine
{
    public interface IVarAccessor
    {
        /// <summary>
        /// Returns the variable value as a rectangular matrix of real
        /// </summary>
        /// <returns>the matrix as a jagged array</returns>
        double[][] AsMatrixOfReal();
        /// <summary>
        /// Returns the variable value as a rectangular matrix of integer
        /// </summary>
        /// <returns>the matrix as a jagged array</returns>
        int[][] AsMatrixOfInteger();
        /// <summary>
        /// Returns the variable value as a vector of double
        /// </summary>
        /// <returns>The resulting vector</returns>
        double[] AsRealArray();
        /// <summary>
        /// Returns the variable value as a scalar double
        /// </summary>
        /// <returns>The value</returns>
        double AsReal();
        /// <summary>
        /// Returns the variable value as a vector of integer
        /// </summary>
        /// <returns>The resulting vector</returns>
        int[] AsIntegerArray();
        /// <summary>
        /// Returns the variable value as a scalar integer
        /// </summary>
        /// <returns>The value</returns>
        int AsInteger();
        /// <summary>
        /// Returns the variable value as a vector of boolean
        /// </summary>
        /// <returns>The resulting vector</returns>
        bool[] AsLogicalArray();
        /// <summary>
        /// Returns the variable value as a scalar boolean
        /// </summary>
        /// <returns>The value</returns>
        bool AsLogicalScalar();
        /// <summary>
        /// Returns the variable value as an array of string
        /// </summary>
        /// <returns>The value</returns>
        string[] AsStringArray();
        /// <summary>
        /// Returns the variable value as a scalar string
        /// </summary>
        /// <returns>The value</returns>
        string AsString();
        /// <summary>
        /// Returns the variable value as an array of dates
        /// </summary>
        /// <returns>The value</returns>
        DateTime[] AsDateTimeArray();
        /// <summary>
        /// Returns the variable value as a scalar date
        /// </summary>
        /// <returns>The value</returns>
        DateTime AsDateTime();
        /// <summary>
        /// Returns the variable value as a data.frame
        /// converted in an enumerable(rows) of object array.
        /// </summary>
        /// <param name="colNames">Output the data frame column names (strings or integers)</param>
        /// <param name="rowNames">Output the data frame row names (strings or integers)</param>
        /// <returns>The data.frame in form of a list of object[](tuples)</returns>
        IEnumerable<object[]> AsDataFrame(out Array colNames, out Array rowNames);
    }
}
